package pharao.client.views.game.landkarte.ort.training;

import pharao.client.views.game.landkarte.ort.training.events.GetTrainingLessonsEvent;
import pharao.client.views.game.landkarte.ort.training.events.ShowTrainingViewEvent;
import hmvc4gwt.client.event.IHmvcEvent;
import hmvc4gwt.framework.client.controller.GuiController;
import hmvc4gwt.framework.client.events.AddViewEvent;
import hmvc4gwt.framework.client.events.ResetViewEvent;

public class TrainingController extends GuiController {

	protected void initImpl() {
		register(ShowTrainingViewEvent.class, this);
	}

	public void handleEventImpl(IHmvcEvent event) {
		if (event instanceof ShowTrainingViewEvent) {
			fireEventLocal(new ResetViewEvent());
			fireEvent(new GetTrainingLessonsEvent(), true, false, false);
			fireEvent(new AddViewEvent(getView()), true, false, false);
		}
	}

	public Class getClassOfObject() {
		return TrainingController.class;
	}

}
